Skip to content

Fix FutureWarning when truth-testing XML element#1027

Merged
geographika merged 1 commit intogeopython:masterfrom
vuilleumierc:fix-wmts-truth-testing-warning
Nov 18, 2025
Merged

Fix FutureWarning when truth-testing XML element#1027
geographika merged 1 commit intogeopython:masterfrom
vuilleumierc:fix-wmts-truth-testing-warning

Conversation

@vuilleumierc
Copy link
Contributor

Instantiating a WebMapTileService currently raises a warning:

>>> from owslib.wmts import WebMapTileService
>>> wmts = WebMapTileService("https://wmts.geo.admin.ch/EPSG/4326/1.0.0/WMTSCapabilities.xml")
/tmp/.venv/lib/python3.10/site-packages/owslib/wmts.py:862: FutureWarning: Truth-testing of elements was a source of confusion and will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
  if current and current.text == 'true':

see also #979

Thanks in advance for considering this PR :)

@geographika
Copy link
Contributor

Looks good to me. Thanks @vuilleumierc.

@geographika geographika merged commit 0b8fbc6 into geopython:master Nov 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants